package com.gla.dao;

import com.gla.domain.Address;
import com.gla.domain.Shop;
import com.gla.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AddressMapper {
    //添加收货地址
    int insert(Address record);

    //查询所有收货地址
    @Select("SELECT * FROM ADDRESS")
    List<Address> getAddress();

    //根据id查询收货地址
    @Select("SELECT * FROM ADDRESS WHERE user_id = #{user_id}")
    List<Address> selectAddressById(Integer user_id);

    //修改收收货地址
    int updateAddress(@Param("address") Address record);

    //根据id查询
    Address selectByPrimaryKey(Integer id);

    //删除收货地址
    @Delete("DELETE FROM ADDRESS WHERE id=#{id}")
    public void deleteAddressById(Integer id);

    //根据id查询默认收货地址
    List<Address> selectDefaultAddById(Integer user_id);
}
